package com.chinasofti.address;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress address=InetAddress.getByName("192.168.43.236");
        String name=address.getHostName();//获取次ip地址主机名
        System.out.println("name = " + name);

        address.getHostAddress();//获取ip地址的字符串
    }
}
